import { createRouter, createWebHistory } from 'vue-router'
import routes from './routers'    // 导入 router 目录下的 routers.js

const router = createRouter({
  history: createWebHistory(import.meta.env.VITE_PATHNAEM),
  routes,
})

router.beforeEach((to, from, next) => {
  if (to.meta.title) {
    document.title = to.meta.title;
  }
  next();
});

export default router